<style>
td {padding:5px 10px;}

</style>
<?php $all_virtual = true; foreach($Carts as $cart) { if(!$cart['Cart']['is_virtual']){$all_virtual=false;break;}  } ?>

<script>

function submitOrder(form){
	{{if !$all_virtual}}
	if($('input[name="data[Order][consignee_id]"]:checked').size() == 0){
		showErrorMessage("{{__('Please choose or add a new consignee at first')}}");
		return false;
	}
	{{/if}}
	return true;
}
</script>

<div  class="container">
	

	<div class="text-center">
		{{if $isWeixin}}
			<a class="btn btn-success" href="javascript:void(0)" onclick="callpay()" >微信支付</a>
			<script>
			function jsApiCall()
			{
				WeixinJSBridge.invoke(
					'getBrandWCPayRequest',
					{{$jsApiParameters}},
					function(res){
						WeixinJSBridge.log(res.err_msg);
						//alert(res.err_code+res.err_desc+res.err_msg);
					}
				);
			}
			
			function callpay()
			{
				if (typeof WeixinJSBridge == "undefined"){
				    if( document.addEventListener ){
				        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
				    }else if (document.attachEvent){
				        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
				        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
				    }
				}else{
				    jsApiCall();
				}
			}
			</script>
		{{else}}
			<div align="center" id="qrcode"></div>
			<p>微信扫码支付</p>
			<script src="/js/qrcode.js"></script>
			<script>
				var url = "<?php echo $wx_qrpay_url;?>";
				//参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
				var qr = qrcode(10, 'M');
				qr.addData(url);
				qr.make();
				var dom=document.createElement('DIV');
				dom.innerHTML = qr.createImgTag();
				var element=document.getElementById("qrcode");
				element.appendChild(dom);
			</script>
				
		{{/if}}
	</div>

	<div class="orderinfo">
			
		{{if !$all_virtual}}
		<h3>订单收货人</h3>
		<div id="part_consignee" class="row clearfix">{{template orders/order_consignee}}</div>
		{{/if}}
		
		<div>
		<h4>商品清单</h4>
		
		<div class="p-list">
			<table  class="table">
			<tr><th width="50%">商品名称</th><th>购买价格</th><th>商品数量</th><th>合计</th></tr>
			<tbody>
			{{loop $Carts $cart}}
			<tr><td>{{$cart['Cart']['name']}}</td>
			<td>{{$cart['Cart']['price']}}</td>
			<td>{{$cart['Cart']['num']}}</td>
			<td>{{$cart['Cart']['price']*$cart['Cart']['num']}}</td>		
			</tr>
			{{/loop}}
			</tbody>
			</table>
		</div></div>		
		<!-- template orders/info_wave  -->
		
		<div class="pull-right">
		<p>总价：</td><td><span id="total-price">{{$total_price}}</span></p>
		
		</div>
	</div>
</div>
